/*
	This file is part of PropExtractor.

	PropExtractor is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	PropExtractor is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with PropExtractor. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _PEALICESOFTIMAGEPMS_H_
#define _PEALICESOFTIMAGEPMS_H_

#include "PEImage.h"

namespace pe
{

	struct PEStream;
	struct PEImageRaw;

	struct AliceImagePmsColor
	{
		byte b, g, r;
	};

	struct AliceImagePmsHeader
	{
		byte header[2];
		byte version[2];
		word header_size;
		byte bpp;
		byte unknown3[3];
		dword unknown4[3];
		dword width;
		dword height;
		dword data_start;
		dword unknown6;
		byte padding[8];
	};

	struct AliceImagePms
	{
		AliceImagePmsHeader* header;

		unsigned int width, height;

		AliceImagePmsColor* colors;
		unsigned int data_size;
		byte* data;
	};

	PE_EXPORT int AliceImagePmsReadHeader(AliceImagePmsHeader* a_Target, PEStream* a_Stream);
	PE_EXPORT int AliceImagePmsReadData(AliceImagePms* a_Target, AliceImagePmsHeader* a_Header, PEStream* a_Stream);
	PE_EXPORT int AliceImagePmsToRaw(PEImageRaw* a_Target, AliceImagePms* a_Image);

	PE_EXPORT int AliceImagePmsReadAndDecrypt(PEImageRaw* a_Target, PEStream* a_Stream);

	PE_EXPORT int AliceImagePmsDeleteHeader(AliceImagePmsHeader* a_Header);
	PE_EXPORT int AliceImagePmsDeleteData(AliceImagePms* a_Image);

	class PE_DLL_EXPORT ImageAliceSoftPms : public PEImage
	{

	public:

		ImageAliceSoftPms();
		~ImageAliceSoftPms();

		int LoadHeader(PEStream* a_Stream);
		int LoadBody();

	protected:

		AliceImagePmsHeader m_Header;
		AliceImagePms m_Body;

	}; // class ImageAliceSoftPms

}; // namespace pe

#endif